﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:behaviors="clr-namespace:MineSweeper.Behaviors"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <LinearGradientBrush x:Key="innerGridMouseOverBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#87D5FF"   Offset="0"/>
        <GradientStop Color="#7EC5FF"   Offset="0.8"/>
        <GradientStop Color="#66ABFF"   Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="outerBorderBackgroundBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#80B9F5"   Offset="0"/>
        <GradientStop Color="#4C63D3"   Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="roundedInnerBorderMouseOverBrush" StartPoint="0,0" EndPoint="1,1">
        <GradientStop Color="#76C0FF"   Offset="0"/>
        <GradientStop Color="#448EFF"   Offset="1"/>
    </LinearGradientBrush>
    <Style TargetType="Border" x:Key="innerBorderStyle">
        <Setter Property="BorderBrush" Value="#33466D"/>
        <Setter Property="BorderThickness" Value="0,0,1,1"/>
    </Style>
    <Style x:Key="roundedInnerBorderStyle" TargetType="Border">
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="CornerRadius" Value="1"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#7DB4F2"   Offset="0"/>
                    <GradientStop Color="#3267E0"   Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="Grid" x:Key="innerGridStyle">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="#FFAFD7F8"   Offset="0"/>
                    <GradientStop Color="#FF6790E8"   Offset="0.5"/>
                    <GradientStop Color="#FF467AE8"   Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="Border" x:Key="outerBorderStyle">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BorderBrush" Value="#1C2F6F"/>
        <Setter Property="BorderThickness" Value="1,1,0,0"/>
        <Setter Property="Background" Value="{StaticResource outerBorderBackgroundBrush}"/>
    </Style>
    <Style TargetType="Border" x:Key="defaultBorderStyle">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="BorderBrush" Value="#1C2F6F"/>
        <Setter Property="BorderThickness" Value="1,1,0,0"/>
    </Style>
    <Style x:Key="tileControlStyle" TargetType="ContentControl">
        <Setter Property="behaviors:MouseBehavior.MonitorMouse" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Grid Name="mainGrid">
                        <Border Style="{StaticResource mainBorderStyle}"/>
                        <Border Name="outerBorder" Style="{StaticResource outerBorderStyle}">
                            <Border Name="innerBorder"  Style="{StaticResource innerBorderStyle}">
                                <Border Name="roundedInnerBorder" Style="{StaticResource roundedInnerBorderStyle}">
                                    <Grid Name="innerGrid" Style="{StaticResource innerGridStyle}"/>
                                </Border>
                            </Border>
                        </Border>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.IsFocused}" Value="true"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.State}" Value="Covered"/>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#3D6DB1"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#6392B8"/>
                            <Setter TargetName="roundedInnerBorder" Property="BorderBrush" Value="{StaticResource roundedInnerBorderMouseOverBrush}"/>
                            <Setter TargetName="innerGrid" Property="Background" Value="{StaticResource innerGridMouseOverBrush}"/>
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.IsFocused}" Value="true"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.State}" Value="Flagged"/>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#3D6DB1"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#6392B8"/>
                            <Setter TargetName="roundedInnerBorder" Property="BorderBrush" Value="{StaticResource roundedInnerBorderMouseOverBrush}"/>
                            <Setter TargetName="innerGrid" Property="Background" Value="{StaticResource innerGridMouseOverBrush}"/>
                        </MultiDataTrigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.IsFocused}" Value="true"/>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.State}" Value="Question"/>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="outerBorder" Property="BorderBrush" Value="#3D6DB1"/>
                            <Setter TargetName="innerBorder" Property="BorderBrush" Value="#6392B8"/>
                            <Setter TargetName="roundedInnerBorder" Property="BorderBrush" Value="{StaticResource roundedInnerBorderMouseOverBrush}"/>
                            <Setter TargetName="innerGrid" Property="Background" Value="{StaticResource innerGridMouseOverBrush}"/>
                        </MultiDataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.State}" Value="Uncovered">
                            <Setter TargetName="outerBorder" Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                        <Trigger Property="behaviors:MouseBehavior.IsMouseLeftButtonDown" Value="true">
                            <Setter TargetName="outerBorder" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsFocused}" Value="true"/>
                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="outerBorder" Property="Visibility" Value="Collapsed"/>
                        </MultiDataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>